local FriendLogic = require("friend.FriendLogic")
local LvRankLogic = require("rank.LvRankLogic")
local FamilyManager = require("family.FamilyManager")
local ServerCommonFW = require("serverCommon.ServerCommonFW")
local Msg = require("core.Msg")
local NoticeExcel = require("excel.Notice")
local OfflinePkLogic = require("offlinepk.OfflinePkLogicW")
local TaskMarket = require("task.TaskMarket")
local ChangeName = require("role.ChangeName")

function onLvUpCB(human)
    FriendLogic.GC_FRIEND_UPDATE(human)
    LvRankLogic.lvChange(nil, human.db)
    FamilyManager.onUserSave(human)
    OfflinePkLogic.checkOfflinePkRank(human)   
    TaskMarket.onTaskMarketLevelup(human) 
end



function LW_LEVEL_UP(human, msg)
    onLvUpCB(human, msg.newLv)
end

function CG_SERVER_NOTICE(human, msg)
    local nMsg = Msg.gc.GC_SERVER_NOTICE
    nMsg.type = msg.type
    if nMsg.type == 1 then
        nMsg.str = NoticeExcel.notice[1].content -- ServerCommonFW.getServerNotice()
    elseif nMsg.type == 2 then
        nMsg.str = NoticeExcel.version[1].content -- ServerCommonFW.getServerVersion()
    end
    nMsg.str = nMsg.str or ""
    Msg.send(nMsg, human.fd)
end

function CG_CHANGE_NAME(human, msg)
  ChangeName.changeName(human, msg.newName)
end
